package Test0109;

import java.io.*;

public class Test04 {
    public static void main(String[] args) throws IOException {
        // (4)把d盘下的文件拷贝到e盘下
        copy("d:/a.txt","d:/b.txt");
    }
    public static void copy(String src,String dest) throws IOException {

        FileReader fileReader = new FileReader(src);
        BufferedReader bufferedReader = new BufferedReader(fileReader);

        FileWriter fileWriter = new FileWriter(dest, true);
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);

        String str = "";
        while ((str = bufferedReader.readLine()) != null) {
            bufferedWriter.write(str);
        }

        bufferedWriter.close();
        fileWriter.close();

        bufferedReader.close();
        fileReader.close();

    }
}